/**
 * Created by Administrator on 2017/5/27.
 */
// function timeout(ms) {
//     return new Promise((resolve, reject) => {
//         // setTimeout(resolve, ms, 'done');
//         setTimeout(reject, ms, 're');
//     });
// }
//
// timeout(100).then((value) => {
//     console.log(value);
// },(res)=>{console.log(res)});

function* helloWorldGenerator() {
    yield 'hello';
    yield 'world';
    return 'ending';
}

var hw = helloWorldGenerator();

hw.next();
console.log(JSON.stringify(hw.next()))